<template>
  <div>
    <el-form inline label-position="right" label-width="220px" class="mt80">
      <el-row class="mt20">
        <el-col :span="24">
          <el-form-item label="fy11banner小图：">
            <my-eleUpload
              :data="smallPicData"
              @reUrlData="getUrlData1"
            ></my-eleUpload>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="fy11banner大图：">
            <my-eleUpload
              :data="smallPicData"
              @reUrlData="getUrlData2"
            ></my-eleUpload>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="图片跳转链接：">
            <el-input v-model="newMaterial.url" style="width: 30vw"> </el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label=" ">
            <el-button @click="submit"> 提交 </el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
import eleUpload from "@/components/upload/elementUpload.vue";
export default {
  data() {
    return {
      flag: false,
      newMaterial: {
        small: "", // 小图
        big: "", // 小图
        url: "", // 跳转链接
      },
      smallPicData: {
        limit: 1,
      },
    };
  },

  components: {
    "my-eleUpload": eleUpload,
  },
  mounted() {},
  methods: {
    // 提交
    submit() {
      if (this.checkInputText()) return;
    },
    // 检查
    checkInputText() {
      if (!!this.newMaterial.small) {
        this.$message.warning("请至少上传一张banner小图");
        return true;
      }
      if (!!this.newMaterial.big) {
        this.$message.warning("请至少上传一张banner大图");
        return true;
      }
      if (!!this.newMaterial.url) {
        this.$message.warning("请填写图片跳转链接");
        return true;
      }
      return false;
    },
    getUrlData1(data) {
      this.newMaterial.small = data;
    },
    getUrlData2(data) {
      this.newMaterial.big = data;
    },
  },
};
</script>
<style lang='stylus' scoped>
body {
}
</style>
